import { createRouter, createWebHashHistory } from "vue-router";

const router = createRouter({
  // history: createWebHistory(import.meta.env.BASE_URL),
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      redirect: "/home",
      children: [
        {
          path: "/home",
          component: () => import("@/layout/index.vue"),
          redirect: "/home/recommend",
          children: [
            {
              path: "/home/recommend", //播放页
              component: () => import("@/views/home/recommend/index.vue"),
            },
            {
              path: "/home/find", //推荐歌单页
              component: () => import("@/views/home/find/index.vue"),
            },
            {
              path: "/home/search", //搜索页
              name: "search",
              component: () => import("@/views/home/searchResult/index.vue"),
            },
            {
              //发现推荐页
              path: "/home/songSheetInfo",
              component: () =>
                import("@/views/home/find/songSheetInfo/index.vue"),
            },
            {//歌单详情页
              path: "/home/songSheetRecommend",
              component:()=>import("@/views/home/find/songSheetRecommend/index.vue")
            },
            {
              //mv播放页
              path: "/home/mvplay",
              component: () => import("@/views/home/mvPlay/index.vue"),
            },
            {
              //视频页
              path: "/home/video",
              component: () => import("@/views/home/video/index.vue"),
            },
            {
              path: "/home/video-detail",
              component: () => import("@/views/home/video/video-detail.vue"),
            },
            {
              path: "/home/record",//我的播放记录页
              component: () => import("@/views/home/record/index.vue"),
            },
            {
              //我的喜欢页
              path: "/home/like",
              component: () => import("@/views/home/myLike/index.vue"),
            },
            {
              //我的
              path: "/home/my",
              component: () => import("@/views/home/my/index.vue"),
            },
            {
              //用户歌单页
              path: "/home/userSongSheet",
              component: () => import("@/views/home/userSongSheet/index.vue"),
            },
            {
              //歌手详情页
              path: "/singer/Details",
              component: () => import("@/views/SingerDetails/index.vue"),
            },
            {
              //歌手全部歌曲页s
              path: "/singer/allSongs",
              component: () =>
                import("@/views/SingerDetails/allSongs/index.vue"),
            },
            {
              //专辑页
              path: "/songs/allAlbums",
              component: () => import("@/views/album/index.vue"),
            },
          ],
        },
      ],
    },
  ],
});
router.beforeEach((to, from, next) => {
  next();
});

export default router;
